/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tubosmonterrey.cotizador.tb;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author rsoberanis
 */
@Entity
@Table(name = "tbproductos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tbproductos.findAll", query = "SELECT t FROM Tbproductos t"),
    @NamedQuery(name = "Tbproductos.findById", query = "SELECT t FROM Tbproductos t WHERE t.id = :id"),
    @NamedQuery(name = "Tbproductos.findByClave", query = "SELECT t FROM Tbproductos t WHERE t.clave = :clave"),
    @NamedQuery(name = "Tbproductos.findByDescripcion", query = "SELECT t FROM Tbproductos t WHERE t.descripcion = :descripcion"),
    @NamedQuery(name = "Tbproductos.findByCosto", query = "SELECT t FROM Tbproductos t WHERE t.costo = :costo"),
    @NamedQuery(name = "Tbproductos.findByPrecio", query = "SELECT t FROM Tbproductos t WHERE t.precio = :precio"),
    @NamedQuery(name = "Tbproductos.findByExistencia", query = "SELECT t FROM Tbproductos t WHERE t.existencia = :existencia")})
public class Tbproductos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "clave")
    private String clave;
    @Column(name = "Descripcion")
    private String descripcion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "costo")
    private Double costo;
    @Column(name = "precio")
    private Double precio;
    @Column(name = "existencia")
    private Integer existencia;
    @OneToMany(mappedBy = "producto")
    private Collection<TbcotizacionPos> tbcotizacionPosCollection;
    @OneToMany(mappedBy = "producto")
    private Collection<TbcotizacionTmpPos> tbcotizacionTmpPosCollection;

    public Tbproductos() {
    }

    public Tbproductos(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getClave() {
        return clave;
    }

    public void setClave(String clave) {
        this.clave = clave;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Double getCosto() {
        return costo;
    }

    public void setCosto(Double costo) {
        this.costo = costo;
    }

    public Double getPrecio() {
        return precio;
    }

    public void setPrecio(Double precio) {
        this.precio = precio;
    }

    public Integer getExistencia() {
        return existencia;
    }

    public void setExistencia(Integer existencia) {
        this.existencia = existencia;
    }

    @XmlTransient
    public Collection<TbcotizacionPos> getTbcotizacionPosCollection() {
        return tbcotizacionPosCollection;
    }

    public void setTbcotizacionPosCollection(Collection<TbcotizacionPos> tbcotizacionPosCollection) {
        this.tbcotizacionPosCollection = tbcotizacionPosCollection;
    }

    @XmlTransient
    public Collection<TbcotizacionTmpPos> getTbcotizacionTmpPosCollection() {
        return tbcotizacionTmpPosCollection;
    }

    public void setTbcotizacionTmpPosCollection(Collection<TbcotizacionTmpPos> tbcotizacionTmpPosCollection) {
        this.tbcotizacionTmpPosCollection = tbcotizacionTmpPosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tbproductos)) {
            return false;
        }
        Tbproductos other = (Tbproductos) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.tubosmonterrey.cotizador.tb.Tbproductos[ id=" + id + " ]";
    }
    
}
